fix(render): last() silently returns nil for []*entity.Entity slices#101
fix(render): last() silently returns nil for []*entity.Entity slices#101greynewell merged 1 commit intomainfrom
Conversation
last() handled []string and []interface{} but was missing the
[]*entity.Entity case that first() already had. Any template calling
{{ last .Entities }} on an entity list would receive nil and produce
a silent empty output instead of the last entity.
Also adds TestFirstLast_EntitySlice covering both functions with entity
slices, including empty-slice behaviour.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 1 minutes and 48 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
last()handled[]stringand[]interface{}but was missing the[]*entity.Entitycase thatfirst()already had{{ last .Entities }}on an entity list would silently receiveniland render nothing, with no error[]*entity.Entitycase tolast()to matchfirst()Test plan
TestFirstLast_EntitySlicecoversfirstandlastwith non-empty and empty entity slicesgo test ./internal/archdocs/pssg/render/...passesgo build ./...passes🤖 Generated with Claude Code